<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script type="text/javascript" th:src="@{/webjars/jquery/3.3.1/jquery.js}"></script>
    <script type="text/javascript" th:src="@{/webjars/bootstrap/3.3.7/js/bootstrap.js}"></script>
    <link rel="stylesheet" th:href="@{/webjars/bootstrap/3.3.7/css/bootstrap.css}" >
</head>
<body>

<div class="container-fluid">
    <div class="row">
        <h1>SSM+SpringBoot-CRUD</h1>
    </div>
    <div class="row">
        <form action="pageBook" method="get">
            <div class="form-inline col-md-12 col-md-offset-2">
                <div class="form-group">
                    <label>书名:</label>
                    <input type="text" name="bookname" class="form-control">
                </div>
                <div class="form-group">
                    <label>作者:</label>
                    <input type="text" name="author" class="form-control">
                </div>
                <div class="form-group">
                    <label>出版社:</label>
                    <input type="text" name="press" class="form-control">
                </div>
                <div class="form-group">
                    <button type="submit" class="btn btn-primary glyphicon glyphicon-search">搜索</button>
                </div>
            </div>
        </form>
    </div>
    <br>
    <br>

    <div class="row">
        <div class="col-sm-12">
            <table class="table table-bordered table-hover table-condensed" id="eatable">
                <thead>
                <tr>
                    <th>编号</th>
                    <th>书名</th>
                    <th>作者</th>
                    <th>出版社</th>
                    <th>定价</th>
                    <th>数量</th>
                    <th>操作</th>
                </tr>
                </thead>
                <tbody>
                <tr th:each="book:${bookIPage.records}">
                    <td th:text="${book.id}"></td>
                    <td th:text="${book.bookname}"></td>
                    <td th:text="${book.author}"></td>
                    <td th:text="${book.press}"></td>
                    <td th:text="${book.price}"></td>
                    <td th:text="${book.numbers}"></td>
                    <td>
                        <button class="btn btn-primary btn-sm" id="upbook">
                            <span class="glyphicon glyphicon-pencil"></span>
                            编辑
                        </button>
                        <button class="btn btn-danger btn-sm deleteBtn" th:attr="del_uri=@{/book/}+${book.id}">
                            <span class="glyphicon glyphicon-trash"></span>
                            删除
                        </button>
                    </td>
                </tr>
                </tbody>
            </table>

        </div>
    </div>

    <div class="row">
        <div class="col-md-4">
            当前页[[${bookIPage.current}]],总共[[${bookIPage.pages}]]页，总记录数[[${bookIPage.total}]]
        </div>
        <div class="col-md-8">
            <div class="col-md-8 col-md-offset-4">
                <ul class="pagination" id="pageinfo">
                    <li><a th:href="'pageBook?pn=1'">首页</a></li>
                    <!--<li th:if="${bookIPage.hasPrevious}">
                        <a th:href="'showbook?pn='+${bookIPage.current-1}">&laquo;</a>
                    </li>-->

                    <li th:each="current:${bookIPage.pages}">

                        <a th:if="${bookIPage.current == current}" th:href="'pageBook?pn='+${current}">[[${current}]]</a>

                        <a th:if="${bookIPage.current != current}" th:href="'pageBook?pn='+${current}">[[${current}]]</a>
                    </li>

                    <!--<li th:if="${bookIPage.hasNext}">
                        <a th:href="'pageBook?pn='+${bookIPage.current+1}">&raquo;</a>
                    </li>-->
                    <li><a th:href="'pageBook?pn='+${bookIPage.pages}">尾页</a></li>
                </ul>
            </div>
        </div>
    </div>
</div>


<script>


</script>
</body>
</html>